<template>
	<view class="app">
		<getheader></getheader>
		<proswiper :imglist="proList[2]['content']" :swipertype="'index'"></proswiper>

		<view class="cate-section">
			<view class="item" v-for="item in cateList" :key="item.id" @click="navToList()">
				<image class="icon" :src="item.icon">
				</image>
				<text>{{ item.name }}</text>
			</view>
		</view>

		<view class="hot-wrap show">
			<view class="floor-header row">
				<image class="icon" src="/static/hot.png"></image>
				<view class="column fill">
					<text class="tit">商城商品</text>
					<text>Shopping Mall</text>
				</view>
				<text class="mix-icon icon-you"></text>
			</view>

			<view class="mix-product-list">
				<view class="list-item column" v-for="item in proList" :key="item.id" @click="navToPro(item.id)">
					<view class="image-wrapper">
						<image :src="item.imglist[0]" mode="aspectFill"></image>
					</view>
					<text class="title clamp2">{{ item.name }}</text>
					<view class="price-wrap row">
						<view class="mix-price-view">
							<span>{{ item.money }}</span>
						</view>
						<text class="m-price">{{ item.price }}</text>
						<view class="fill"></view>
						<view class="tag center">
							<text>免邮费</text>
						</view>
					</view>
				</view>
			</view>

		</view>
	</view>
</template>

<script>
	import getheader from '@/pages/components/getheader.vue';
	import proswiper from '@/pages/components/proswiper.vue';
	export default {
		components: {
			getheader,
			proswiper,
		},
		data() {
			return {
				cateList: [],
				proList: [],
			}
		},
		onLoad() {
			this.cateList = this.globals.cateList;
			this.proList = this.globals.proList;
		},
		methods: {
			navToList() {
				let url = '/pages/produce/lists?cateId=' + this.currentid + '&firstCateId=11';
				this.navTo(url);
			},
			navToPro(proId) {
				let url = '/pages/produce/details?proId=' + proId;
				this.navTo(url);
			}
		}
	}
</script>

<style>
	page {
		background-color: #f7f7f7;
	}
</style>
<style scoped lang="scss">
	/* 分类 */
	.cate-section {
		display: flex;
		align-items: center;
		flex-wrap: wrap;
		padding: 1vw 1vw;
		background: #fff;

		.item {
			display: flex;
			flex-direction: column;
			align-items: center;
			width: 20%;
			padding: 1vw 0 2vw 0;
			font-size: 3vw;
			color: #333;
		}

		.icon {
			width: 60%;
			height: 11vw;
			margin-bottom: 2vw;
			border-radius: 50%;
		}
	}



	.floor-header {
		padding: 1vw 3vw 3vw 3vw;
		font-size: 4vw;
		color: #999;
		background-color: #fff;

		.icon {
			flex-shrink: 0;
			width: 8vw;
			height: 8vw;
			margin-right: 3%;
		}

		.tit-box {
			flex: 1;
			display: flex;
			flex-direction: column;
		}

		.tit {
			margin-bottom: 1vw;
			font-size: 3vw;
			color: #333;
			font-weight: 700;
		}

		.icon-you {
			font-size: 2.5vw;
			color: #999;
		}
	}

	.hot-wrap {
		padding-top: 20rpx;
		background: linear-gradient(to bottom, #fff 10rpx, #f7f7f7);
		opacity: 0;
		transition: opacity .2s;

		&.show {
			opacity: 1;
		}

		.floor-header {
			padding-bottom: 30rpx;
		}

		/deep/ .list-item {
			box-shadow: 4rpx 0 10rpx rgba(0, 0, 0, .06);
		}
	}





	.mix-product-list {
		display: flex;
		justify-content: space-between;
		flex-wrap: wrap;
		width: 96%;
		margin: 0 2% 0 2%;
		background-color: #f7f7f7;

		&.is-row {
			margin-top: -4rpx;
			border-radius: 8rpx;
			box-shadow: 4rpx 4rpx 20rpx rgba(0, 0, 0, .06);
			overflow: hidden;
		}
	}


	.list-item.column {
		width: 50%;
		padding-bottom: 1vw;
		margin-bottom: 1vw;
		background: #fff;
		border-radius: 1vw;
		overflow: hidden;
		box-shadow: 0 0 16rpx rgba(0, 0, 0, .06);
		position: relative;

		.image-wrapper {
			width: 96%;
			height: 46vw;
			overflow: hidden;
			margin: 0 2% 0 2%;

			image {
				width: 100%;
				height: 100%;
			}
		}

		.title {
			font-size: 2.5vw;
			color: #333;
			line-height: 4.5vw;
			padding: 0 1vw;
			margin-top: 1vw;
			height: 9vw;
		}

		.price-wrap {
			padding: 0 1vw;
			margin-top: 2vw;
		}

		.m-price {
			font-size: 2.5vw;
			text-decoration: line-through;
			color: #999;
			margin-left: 0.5vw;

			&:before {
				content: "￥";
			}
		}

		.mix-price-view {
			font-size: 4vw;
			color: #ff536f;

			&:before {
				content: "￥";
			}
		}

		.tag {
			height: 5vw;
			padding: 0 1vw;
			font-size: 2.5vw;
			background-color: $base-color;
			color: #fff;
			border-radius: 1vw;
			transform: translateY(-4rpx);
		}
	}
</style>
